#!/bin/sh

set -e

if [ $# -eq 1 ]; then
    day="$1"
else
    day=`date +%Y%m%d --date '-1 day'`
fi
baseurl="http://10.5.12.243:50075/streamFile/dsap/resultdata/ec_data/EC_Post_Detail_Job/${day}"
# ?nnaddr=10.5.12.196:9000
toppart=4
i=0
while [ $i -lt $toppart ]; do
    part=part-r-`printf "%05d" $i`
    fullurl="${baseurl}/${part}?nnaddr=10.5.12.196:9000"
    # echo $fullurl
    wget $fullurl
    i=`expr $i + 1`
done

python /work/opt/fourthinfo/data//formatMysqlRow.py .  ${day} 1>logs/stdout_${day}.log 2>logs/stderr_${day}.log &
